<%@ page language="java" pageEncoding="ISO-8859-1"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

<!-- Importaciones de dwr -->
  <script type='text/javascript' src='../../dwr/engine.js'> </script>
  <script type='text/javascript' src='../../dwr/util.js'> </script>
  <script type='text/javascript' src='../../dwr/interface/UploadDownload.js'> </script>
  <script type="text/javascript" src='../../scripts/upload.js'> </script>

<script type="text/javascript" src='../../scripts/general.js'> </script>

<html:form action="/plantillasAdmin.do?" method="POST" enctype="multipart/form-data">
	
	<br>
	<fieldset>
	<legend>Plantillas</legend>
	<table width="100%">
		<tr height="7px"></tr>
		<tr>
			<td align="center" colspan="1">
				<label>Adjuntar Archivos: </label>
				<html:file property="archivo" size="25"/><html:submit property="boton" value="Adjuntar"></html:submit>
				<br><span class="error"><html:errors property="errFile"/></span>
				<!--<input type="file" id="uploadFile" size="30"/>	<input type="button" value="Adjuntar" onclick="uploadFiles();">-->
				</td>
		</tr>
		<tr height="7px"></tr>
		<tr>
			<td>
				<div id="tablewrapper">
					<div id="tableheader">
			        	<div class="search">
			                <select id="columns" onchange="sorter.search('query')"></select>
			                <input type="text" id="query" onkeyup="sorter.search('query')" />
			            </div>
			            <span class="details">
							<div>Records <span id="startrecord"></span>-<span id="endrecord"></span> of <span id="totalrecords"></span></div>
			        		<div><a href="javascript:sorter.reset()">reset</a></div>
			        	</span>
			        </div>
			        <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
			            <thead>
			                <tr>
			                    <th><h3>Nombre Archivo</h3></th>
			                    <th class="nosort" width="30%"><h3>Descargar</h3></th>
			                    
			                </tr>
			            </thead>
			            <tbody>
			            
			         <logic:iterate id="listaFile" name="listaPlantillas">
		            	<tr>
		            		<td>
			            		<bean:write name="listaFile" property="nombre"/>
			            	</td>
			            	<td align="center">
		                    	<html:link href="../../descargaServlet" paramId="file" paramName="listaFile" paramProperty="idTmp" title="Descargar">
									<html:img src="../../imagenes/download.png"/>
								</html:link>
		                    	<html:link action="plantillasAdmin" paramId="fileTmp" paramName="listaFile" paramProperty="idTmp" title="Eliminar">
									<html:img src="../../imagenes/close.png"/>
								</html:link>
		                    </td>	
		            	</tr>
		            </logic:iterate>
			            </tbody>
			        </table>
			        <div id="tablefooter">
			          <div id="tablenav">
			            	<div>
			                    <img src="../../imagenes/first.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1,true)" />
			                    <img src="../../imagenes/previous.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1)" />
			                    <img src="../../imagenes/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />
			                    <img src="../../imagenes/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />
			                </div>
			                <div>
			                	<select id="pagedropdown"></select>
							</div>
			                <div>
			                	<a href="javascript:sorter.showall()">view all</a>
			                </div>
			            </div>
						<div id="tablelocation">
			            	<div>
			                    <select onchange="sorter.size(this.value)">
			                    <option value="5">5</option>
			                        <option value="10" selected="selected">10</option>
			                        <option value="20">20</option>
			                        <option value="50">50</option>
			                        <option value="100">100</option>
			                    </select>
			                    <span>Entries Per Page</span>
			                </div>
			                <div class="page">Page <span id="currentpage"></span> of <span id="totalpages"></span></div>
			            </div>
			        </div>
			    </div>
			    
			</td>
		</tr>
		<tr height="7px"></tr>
	</table>
	</fieldset>
    <br>
    <div align="center">
    	<html:submit property="boton" value="ACTUALIZAR"/>
    	<html:submit property="boton" value="CANCELAR"/>
    </div>
</html:form>

	<script type="text/javascript">
	var sorter = new TINY.table.sorter('sorter','table',{
		headclass:'head',
		ascclass:'asc',
		descclass:'desc',
		evenclass:'evenrow',
		oddclass:'oddrow',
		evenselclass:'evenselected',
		oddselclass:'oddselected',
		paginate:true,
		size:10,
		colddid:'columns',
		currentid:'currentpage',
		totalid:'totalpages',
		startingrecid:'startrecord',
		endingrecid:'endrecord',
		totalrecid:'totalrecords',
		hoverid:'selectedrow',
		pageddid:'pagedropdown',
		navid:'tablenav',
		sortcolumn:1,
		sortdir:1,
		sum:[8],
		avg:[6,7,8,9],
		columns:[{index:7, format:'%', decimals:1},{index:8, format:'$', decimals:0}],
		init:true
	});
  </script>
	
<script type="text/javascript">//<![CDATA[
  Calendar.setup({
    inputField : "f_date1",
    trigger    : "f_btn1",
    onSelect   : function() { this.hide() },
    showTime   : 12,
    dateFormat : "%Y-%m-%d %H:%M"
  });
//]]></script>
	

